<div id="historycontent" class="historycontent container">
	<div id="historydata" class="log">
	</div>
</div>

<script type="text/javascript" charset="utf-8">

function ShowHistory(historytype)
{
	var div = $("#historycontent #historydata");
	var htmlcontent = '';
  
	$.ajax({
		url: "json.htm?type=command&param=" + historytype, 
		async: false, 
		dataType: 'json',
		success: function(data) {
			if (typeof data.result != 'undefined') {
				$.each(data.result, function(i,item){
					if (item.level==0) {
						htmlcontent+='<span>';
					}
					else {
						htmlcontent+='<span class="logerror"><b>';
					}
					var message=item.message.replace(/\n/gi,"<br>");
					htmlcontent+=message;
					if (item.level==1) {
						htmlcontent+="</b>";
					}
					htmlcontent+='</span><br>\n';
				});
			}
		}
	});
	if (htmlcontent!="") {
		$("#historycontent #historydata").append(htmlcontent);
		ResizeLogWindow();
		$("#historycontent #historydata").scrollTop(0);
	}
}

$(window).resize(function() {
	ResizeLogWindow();
});

function ResizeLogWindow()
{
	var pheight=$(window).innerHeight();
	$("#historycontent #historydata").height(pheight-130);
}

$(document).ready(function() {
	var bShowNewHistory=false;
	if ($.myglobals.historytype != 'undefined') {
		if ($.myglobals.historytype == 2)
		{
			bShowNewHistory=true;
		}
	}
	if (bShowNewHistory == false) {
		ShowHistory("getactualhistory");
	}
	else {
		ShowHistory("getnewhistory");
	}
	ResizeLogWindow();
} );  
</script>
